/*     */ package dm.jdbc.dbaccess;
/*     */ 
/*     */ import com.jcraft.jzlib.ZlibUtil;
/*     */ import dm.jdbc.dbaccess.ssl.MakeSSLSocket;
/*     */ import dm.jdbc.driver.DmdbConnection_bs;
/*     */ import dm.jdbc.util.IPAddressUtil;
/*     */ import dm.jdbc.util.List;
/*     */ import java.io.BufferedInputStream;
/*     */ import java.io.BufferedOutputStream;
/*     */ import java.io.ByteArrayOutputStream;
/*     */ import java.io.EOFException;
/*     */ import java.io.IOException;
/*     */ import java.io.InputStream;
/*     */ import java.io.OutputStream;
/*     */ import java.net.InetAddress;
/*     */ import java.net.InetSocketAddress;
/*     */ import java.net.Socket;
/*     */ import java.net.UnknownHostException;
/*     */ import java.security.KeyPair;
/*     */ import java.security.MessageDigest;
/*     */ import java.security.NoSuchAlgorithmException;
/*     */ import java.security.PrivateKey;
/*     */ import java.sql.SQLException;
/*     */ import java.util.Properties;
/*     */ import javax.crypto.Cipher;
/*     */ import javax.crypto.interfaces.DHPublicKey;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DbPureAccess
/*     */ {
/*  55 */   private OutputStream dmOutput = null;
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*  60 */   private InputStream dmInput = null;
/*     */   
/*     */ 
/*  63 */   private Socket dmConnection = null;
/*     */   
/*  65 */   private int netPort = 5236;
/*     */   
/*  67 */   private String hostName = null;
/*     */   
/*  69 */   private Properties props = null;
/*     */   
/*  71 */   private int netPacketSize = 8192;
/*     */   
/*  73 */   private int ifCompress = 0;
/*     */   
/*  75 */   private AuthInfo m_kerberosAuth = null;
/*     */   
/*  77 */   private int connTimeout = 0;
/*     */   
/*  79 */   private KeyPair clientKeyPair = null;
/*     */   
/*  81 */   private Cipher encryptCipher = null;
/*     */   
/*  83 */   private Cipher decryptCipher = null;
/*     */   
/*  85 */   private int msgEncryptType = -1;
/*     */   
/*  87 */   private int isLocal = -1;
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public DbPureAccess(DmdbConnection_bs conn)
/*     */     throws IOException
/*     */   {
/* 100 */     if (conn.getPortNumber() != null) {
/* 101 */       this.netPort = Integer.parseInt(conn.getPortNumber());
/*     */     }
/*     */     
/* 104 */     setHostName(conn.getHostName());
/*     */     
/* 106 */     this.props = conn.getProperties();
/*     */     
/* 108 */     this.connTimeout = conn.getConnectTimeout();
/*     */     
/*     */ 
/* 111 */     changeSocket(createSocket(this.hostName, this.netPort, this.connTimeout));
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public DbPureAccess(DmdbConnection_bs conn, String host, int port)
/*     */     throws IOException
/*     */   {
/* 126 */     this.netPort = port;
/*     */     
/* 128 */     setHostName(host);
/*     */     
/* 130 */     this.props = conn.getProperties();
/*     */     
/* 132 */     this.connTimeout = conn.getConnectTimeout();
/*     */     
/*     */ 
/* 135 */     changeSocket(createSocket(this.hostName, this.netPort, this.connTimeout));
/*     */   }
/*     */   
/*     */   public void tryEnableSSL(boolean useSSLSocket) throws IOException, SQLException
/*     */   {
/* 140 */     MakeSSLSocket ssl = new MakeSSLSocket();
/* 141 */     ssl.convert(this, this.props, useSSLSocket);
/*     */   }
/*     */   
/*     */   public synchronized DmMsgRecv access(DmMsgSend sendMsg) throws SQLException, IOException
/*     */   {
/* 146 */     send(sendMsg);
/*     */     
/* 148 */     return readPacket();
/*     */   }
/*     */   
/*     */   public void setSocketInfo(String host, String port) throws UnknownHostException, IOException
/*     */   {
/* 153 */     setHostName(host);
/* 154 */     this.netPort = Integer.parseInt(port);
/*     */     
/*     */ 
/* 157 */     changeSocket(createSocket(this.hostName, this.netPort, this.connTimeout));
/*     */   }
/*     */   
/*     */   public void setCompress(int isCompr) {
/* 161 */     this.ifCompress = isCompr;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public void changeSocket(Socket socket)
/*     */     throws IOException
/*     */   {
/* 175 */     this.dmConnection = socket;
/*     */     
/*     */ 
/*     */ 
/* 179 */     this.dmConnection.setTcpNoDelay(true);
/* 180 */     this.dmConnection.setKeepAlive(true);
/*     */     
/*     */ 
/* 183 */     this.dmInput = new BufferedInputStream(this.dmConnection.getInputStream(), 
/* 184 */       this.netPacketSize);
/* 185 */     this.dmOutput = new BufferedOutputStream(this.dmConnection.getOutputStream(), 
/* 186 */       this.netPacketSize);
/*     */   }
/*     */   
/*     */   public final Socket getSocket() {
/* 190 */     return this.dmConnection;
/*     */   }
/*     */   
/*     */   public final String getHostName() {
/* 194 */     return this.hostName;
/*     */   }
/*     */   
/*     */   public final void setHostName(String host) {
/* 198 */     this.hostName = host;
/* 199 */     this.isLocal = -1;
/*     */   }
/*     */   
/*     */   private boolean getIsLocal()
/*     */   {
/* 204 */     if (this.isLocal == -1)
/*     */     {
/* 206 */       if ((this.hostName != null) && (this.hostName.length() > 0)) {
/* 207 */         this.isLocal = (isLocalHost(this.hostName) ? 1 : 0);
/*     */       }
/*     */     }
/* 210 */     return this.isLocal == 1;
/*     */   }
/*     */   
/* 213 */   private static boolean isLocalHost(String host) { if (("localhost".equalsIgnoreCase(host)) || ("127.0.0.1".equals(host)) || 
/* 214 */       ("::1".equals(host))) {
/* 215 */       return true;
/*     */     }
/*     */     String host2;
/*     */     try
/*     */     {
/* 220 */       host2 = InetAddress.getByName(host).getHostAddress();
/*     */     } catch (UnknownHostException x) { String host2;
/* 222 */       host2 = host;
/*     */     }
/*     */     String localhostIP;
/*     */     try
/*     */     {
/* 227 */       localhostIP = InetAddress.getLocalHost().getHostAddress();
/*     */     } catch (UnknownHostException x) { String localhostIP;
/* 229 */       localhostIP = null;
/*     */     }
/*     */     
/* 232 */     return host2.equalsIgnoreCase(localhostIP);
/*     */   }
/*     */   
/*     */   public final int getPortNumber() {
/* 236 */     return this.netPort;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public final void close()
/*     */   {
/* 244 */     this.clientKeyPair = null;
/* 245 */     this.encryptCipher = null;
/* 246 */     this.decryptCipher = null;
/* 247 */     this.msgEncryptType = -1;
/*     */     try {
/* 249 */       if (this.dmInput != null) {
/* 250 */         this.dmInput.close();
/* 251 */         this.dmInput = null;
/*     */       }
/*     */     }
/*     */     catch (Exception Ex)
/*     */     {
/* 256 */       this.dmInput = null;
/*     */     }
/*     */     try
/*     */     {
/* 260 */       if (this.dmOutput != null) {
/* 261 */         this.dmOutput.close();
/* 262 */         this.dmOutput = null;
/*     */       }
/*     */     }
/*     */     catch (Exception Ex)
/*     */     {
/* 267 */       this.dmOutput = null;
/*     */     }
/*     */     try
/*     */     {
/* 271 */       if (this.dmConnection != null) {
/* 272 */         this.dmConnection.close();
/* 273 */         this.dmConnection = null;
/*     */       }
/*     */     }
/*     */     catch (Exception Ex)
/*     */     {
/* 278 */       this.dmConnection = null;
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   protected void finalize()
/*     */   {
/* 286 */     close();
/*     */   }
/*     */   
/*     */   private final DmMsgRecv readPacket_only() throws IOException {
/* 290 */     DmMsgRecv msg = new DmMsgRecv();
/* 291 */     int ret_len = readOnce(this.dmInput, msg.getBuffer(), 0, 32640);
/* 292 */     if (ret_len <= 0) {
/* 293 */       throw new IOException();
/*     */     }
/* 295 */     long msgLen = msg.res_get_len();
/* 296 */     msgLen += 64L;
/*     */     
/* 298 */     if (msgLen > msg.getBufLength()) {
/* 299 */       msg.setBuffer((int)msgLen);
/*     */     }
/*     */     
/* 302 */     if (ret_len < msgLen) {
/* 303 */       readFully(this.dmInput, msg.getBuffer(), ret_len, 
/* 304 */         (int)(msgLen - ret_len));
/*     */     }
/* 306 */     return msg;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   private final DmMsgRecv readPacket()
/*     */     throws IOException, SQLException
/*     */   {
/* 319 */     DmMsgRecv msg = readPacket_only();
/*     */     
/* 321 */     if (!msg.checkCRC()) {
/* 322 */       DBError.throwSQLException(6002);
/*     */     }
/*     */     
/* 325 */     if ((this.msgEncryptType != -1) && (msg.res_get_len() != 0L)) {
/* 326 */       int srcLen = (int)msg.res_get_len();
/* 327 */       byte[] tmp = new byte[srcLen];
/* 328 */       System.arraycopy(msg.getBuffer(), 64, tmp, 0, 
/* 329 */         srcLen);
/* 330 */       byte[] decomBuf = symmetricDecrypto(tmp, srcLen, true);
/*     */       
/* 332 */       int desLen = decomBuf.length;
/*     */       
/* 334 */       if (desLen + 64 > msg.getBufLength()) {
/* 335 */         msg.setBuffer(desLen + 64);
/*     */       }
/* 337 */       msg.res_set_len(desLen);
/*     */       
/* 339 */       System.arraycopy(decomBuf, 0, msg.getBuffer(), 
/* 340 */         64, desLen);
/*     */     }
/*     */     
/* 343 */     long resLen = msg.res_get_len();
/* 344 */     if (((this.ifCompress == 1) && (resLen > 0L)) || (
/* 345 */       (this.ifCompress == 2) && (msg.res_get_compress() == 1)))
/*     */     {
/* 347 */       byte[] tmp = new byte[(int)msg.res_get_len()];
/* 348 */       System.arraycopy(msg.getBuffer(), 68, 
/* 349 */         tmp, 0, 
/* 350 */         (int)(msg.res_get_len() - 4L));
/* 351 */       byte[] decomBuf = ZlibUtil.uncompress(tmp);
/*     */       
/* 353 */       int desLen = decomBuf.length;
/*     */       
/* 355 */       if (desLen + 64 > msg.getBufLength()) {
/* 356 */         msg.setBuffer(desLen + 64);
/*     */       }
/* 358 */       msg.res_set_len(desLen);
/*     */       
/* 360 */       System.arraycopy(decomBuf, 0, msg.getBuffer(), 
/* 361 */         64, desLen);
/*     */     }
/*     */     
/*     */ 
/* 365 */     return msg;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   private final int readFully(InputStream in, byte[] b, int off, int len)
/*     */     throws IOException
/*     */   {
/* 383 */     if (len < 0) {
/* 384 */       throw new IndexOutOfBoundsException();
/*     */     }
/*     */     
/* 387 */     int n = 0;
/*     */     
/* 389 */     while (n < len) {
/* 390 */       int count = in.read(b, off + n, len - n);
/*     */       
/* 392 */       if (count < 0) {
/* 393 */         throw new EOFException();
/*     */       }
/*     */       
/* 396 */       n += count;
/*     */     }
/*     */     
/* 399 */     return n;
/*     */   }
/*     */   
/*     */   private final int readOnce(InputStream in, byte[] b, int off, int len) throws IOException
/*     */   {
/* 404 */     if (len < 0) {
/* 405 */       throw new IndexOutOfBoundsException();
/*     */     }
/*     */     
/* 408 */     int count = in.read(b, off, len);
/* 409 */     return count;
/*     */   }
/*     */   
/*     */   private final DmMsgSend pre_send(DmMsgSend msg) throws SQLException {
/* 413 */     int reqLen = msg.req_get_len();
/*     */     
/* 415 */     if (((this.ifCompress == 1) && (reqLen > 0)) || (
/* 416 */       (this.ifCompress == 2) && (!getIsLocal()) && (reqLen > 8192))) {
/* 417 */       byte[] tmp = msg.getFromOffsetWithLen(64, reqLen);
/* 418 */       byte[] comBuf = ZlibUtil.compress(tmp);
/*     */       
/* 420 */       int offset = 64;
/*     */       
/* 422 */       msg.setInt(reqLen, offset);
/* 423 */       offset += 4;
/*     */       
/*     */ 
/* 426 */       msg.req_set_len(comBuf.length + 4);
/*     */       
/* 428 */       msg.req_set_compress((byte)1);
/*     */       
/* 430 */       msg.replaceFromOffset(offset, comBuf);
/*     */     }
/*     */     else
/*     */     {
/* 434 */       msg.req_set_compress((byte)0);
/*     */     }
/* 436 */     reqLen = msg.req_get_len();
/*     */     
/*     */ 
/* 439 */     if ((this.msgEncryptType != -1) && (reqLen != 0)) {
/* 440 */       byte[] tmp = msg.getFromOffsetWithLen(64, 
/* 441 */         reqLen);
/* 442 */       byte[] encBuf = symmetricEncrypto(tmp, reqLen, true);
/*     */       
/* 444 */       int offset = 64;
/*     */       
/* 446 */       msg.req_set_len(encBuf.length);
/*     */       
/* 448 */       msg.replaceFromOffset(offset, encBuf);
/*     */     }
/*     */     
/* 451 */     msg.setCRC(msg.calculateCRC());
/*     */     
/* 453 */     return msg;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   private final void send(DmMsgSend msgIn)
/*     */     throws IOException, SQLException
/*     */   {
/* 468 */     DmMsgSend msgExtend = pre_send(msgIn);
/*     */     
/* 470 */     msgExtend.resetListPointer();
/* 471 */     DmMsgSend.BufferNode node = msgExtend.getFirstNode();
/*     */     
/* 473 */     while (node != null) {
/* 474 */       if (node.getBufferLen() != 0) {
/* 475 */         this.dmOutput.write(node.buffer, 0, node.getBufferLen());
/* 476 */         this.dmOutput.flush();
/*     */       }
/*     */       
/* 479 */       if (node == msgExtend.getBufferList().getTail()) {
/*     */         break;
/*     */       }
/* 482 */       node = msgExtend.getNextNode();
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public final int getNetPacketSize()
/*     */   {
/* 490 */     return this.netPacketSize;
/*     */   }
/*     */   
/*     */   public AuthInfo getAuthInfo(String kerberosUser, String loginPath, int authType)
/*     */     throws SQLException
/*     */   {
/* 496 */     if (this.m_kerberosAuth != null) {
/* 497 */       this.m_kerberosAuth = null;
/*     */     }
/* 499 */     Auth auth = null;
/*     */     
/*     */     try
/*     */     {
/* 503 */       if ((loginPath != null) && (loginPath.length() > 0)) {
/* 504 */         System.setProperty("java.security.auth.login.config", loginPath);
/*     */       }
/* 506 */       if ((kerberosUser != null) && (kerberosUser.length() > 0)) {
/* 507 */         System.setProperty("sun.security.krb5.principal", kerberosUser + 
/* 508 */           "@DAMENG.ORG");
/*     */       }
/* 510 */       auth = new Auth(this.dmConnection.getInetAddress()
/* 511 */         .getCanonicalHostName(), authType);
/*     */     } catch (UnknownHostException e1) {
/* 513 */       DBError.throwSQLException(6063);
/*     */     }
/*     */     
/* 516 */     this.m_kerberosAuth = auth.getAuthInfo();
/*     */     
/* 518 */     return this.m_kerberosAuth;
/*     */   }
/*     */   
/*     */   public AuthInfo getAuthInfo() {
/* 522 */     return this.m_kerberosAuth;
/*     */   }
/*     */   
/*     */   public void reset() throws SQLException {
/*     */     try {
/* 527 */       if (this.dmConnection != null) {
/* 528 */         this.dmConnection.close();
/*     */       }
/*     */     } catch (IOException ioex) {
/* 531 */       throw new SQLException(ioex.getMessage());
/*     */     }
/*     */   }
/*     */   
/*     */   private Socket createSocket(String hostName, int netPort, int timeOut) throws IOException
/*     */   {
/* 537 */     byte[] addr = IPAddressUtil.textToNumericFormatV4(hostName);
/* 538 */     if (addr == null)
/* 539 */       addr = IPAddressUtil.textToNumericFormatV6(hostName);
/* 540 */     Socket socket = new Socket();
/* 541 */     InetSocketAddress socketAddress = null;
/* 542 */     if (addr != null) {
/* 543 */       InetAddress address = InetAddress.getByAddress(hostName, addr);
/* 544 */       socketAddress = new InetSocketAddress(address, netPort);
/*     */     } else {
/* 546 */       socketAddress = new InetSocketAddress(hostName, netPort);
/*     */     }
/* 548 */     socket.connect(socketAddress, timeOut);
/* 549 */     return socket;
/*     */   }
/*     */   
/*     */   public byte[] getClientPubKey() throws SQLException {
/* 553 */     if (this.clientKeyPair == null) {
/* 554 */       this.clientKeyPair = MsgSecurity.newClientKeyPair();
/*     */     }
/*     */     
/* 557 */     return MsgSecurity.bn2Bytes(
/* 558 */       ((DHPublicKey)this.clientKeyPair.getPublic()).getY(), 
/* 559 */       64);
/*     */   }
/*     */   
/*     */   public PrivateKey getClientPrivKey() throws SQLException
/*     */   {
/* 564 */     if (this.clientKeyPair == null) {
/* 565 */       this.clientKeyPair = MsgSecurity.newClientKeyPair();
/*     */     }
/*     */     
/* 568 */     return this.clientKeyPair.getPrivate();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public final void genMsgCiphers(int msgCipherType, byte[] tempSessionKey)
/*     */     throws SQLException
/*     */   {
/* 578 */     byte[] sessionKey = null;
/*     */     
/* 580 */     SymmCipherDesc cipherDesc = null;
/*     */     
/* 582 */     if (-1 == msgCipherType) {
/* 583 */       this.encryptCipher = null;
/* 584 */       this.decryptCipher = null;
/* 585 */       return;
/*     */     }
/*     */     
/*     */ 
/* 589 */     cipherDesc = new SymmCipherDesc(msgCipherType);
/*     */     
/* 591 */     int keySize = cipherDesc.getKeyLength();
/*     */     
/* 593 */     if (256 == cipherDesc.getAlgorithmType()) {
/* 594 */       keySize += 8;
/*     */     }
/* 596 */     sessionKey = new byte[keySize];
/*     */     
/* 598 */     System.arraycopy(tempSessionKey, 0, sessionKey, 0, keySize);
/*     */     
/* 600 */     if (256 == cipherDesc.getAlgorithmType()) {
/* 601 */       System.arraycopy(tempSessionKey, 0, sessionKey, keySize - 8, 8);
/*     */     }
/*     */     
/*     */     try
/*     */     {
/* 606 */       this.encryptCipher = MsgSecurity.newCipher(1, 
/* 607 */         cipherDesc, sessionKey);
/* 608 */       this.decryptCipher = MsgSecurity.newCipher(2, 
/* 609 */         cipherDesc, sessionKey);
/*     */     } catch (Exception e) {
/* 611 */       this.encryptCipher = null;
/* 612 */       this.decryptCipher = null;
/* 613 */       DBError.throwSQLException(6061);
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   protected byte[] symmetricEncrypto(byte[] byteSource, int length, boolean gen_digest)
/*     */     throws SQLException
/*     */   {
/*     */     try
/*     */     {
/* 631 */       if (!gen_digest) {
/* 632 */         return this.encryptCipher.doFinal(byteSource, 0, length);
/*     */       }
/* 634 */       ByteArrayOutputStream baos = new ByteArrayOutputStream(length + 
/* 635 */         16);
/* 636 */       baos.write(this.encryptCipher.doFinal(byteSource, 0, length));
/* 637 */       baos.write(genMessageDigest(4352, byteSource));
/* 638 */       return baos.toByteArray();
/*     */     }
/*     */     catch (Exception e) {
/* 641 */       DBError.throwSQLException(e.getMessage());
/*     */     }
/* 643 */     return new byte[0];
/*     */   }
/*     */   
/*     */   private byte[] symmetricDecrypto(byte[] byteSource, int length, boolean gen_digest) throws SQLException
/*     */   {
/* 648 */     byte[] digest = new byte[16];
/* 649 */     byte[] plain_text = null;
/*     */     try
/*     */     {
/* 652 */       if (gen_digest) {
/* 653 */         System.arraycopy(byteSource, length - 16, 
/* 654 */           digest, 0, 16);
/* 655 */         plain_text = this.decryptCipher.doFinal(byteSource, 0, length - 
/* 656 */           16);
/* 657 */         checkMessageDigest(4352, plain_text, digest);
/*     */       }
/* 659 */       return this.decryptCipher.doFinal(byteSource, 0, length);
/*     */ 
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 664 */       DBError.throwSQLException(e.getMessage());
/*     */     }
/*     */     
/* 667 */     return new byte[0];
/*     */   }
/*     */   
/*     */   private final byte[] genMessageDigest(int algorithm, byte[] msg_text) throws NoSuchAlgorithmException {
/* 671 */     MessageDigest md = null;
/* 672 */     byte[] msg_digest = null;
/*     */     
/* 674 */     switch (algorithm) {
/*     */     case 4352: 
/* 676 */       md = MessageDigest.getInstance("MD5");
/* 677 */       break;
/*     */     }
/*     */     
/*     */     
/*     */ 
/* 682 */     if (md == null) {
/* 683 */       return null;
/*     */     }
/*     */     
/* 686 */     md.reset();
/* 687 */     md.update(msg_text);
/* 688 */     msg_digest = md.digest();
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/* 699 */     return msg_digest;
/*     */   }
/*     */   
/*     */   private final boolean checkMessageDigest(int algorithm, byte[] msg_text, byte[] digest) throws NoSuchAlgorithmException
/*     */   {
/* 704 */     byte[] msg_digest = null;
/*     */     
/* 706 */     msg_digest = genMessageDigest(algorithm, msg_text);
/*     */     
/* 708 */     if (digest.length != msg_digest.length) {
/* 709 */       return false;
/*     */     }
/*     */     
/* 712 */     for (int i = 0; i < digest.length; i++) {
/* 713 */       if (digest[i] != msg_digest[i]) {
/* 714 */         return false;
/*     */       }
/*     */     }
/*     */     
/* 718 */     return true;
/*     */   }
/*     */   
/*     */   public void setMsgEncryptType(int msgEncryptType) {
/* 722 */     this.msgEncryptType = msgEncryptType;
/*     */   }
/*     */   
/*     */   public int getMsgEncryptType() {
/* 726 */     return this.msgEncryptType;
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\dbaccess\DbPureAccess.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */